package day08.ZiXi;

import java.util.ArrayList;
import java.util.Collection;

public class Collection01 {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        ////boolean add(E e)添加元素
        c.add("123");
        c.add("456");
        c.add("789");
        c.add("1599");
        System.out.println(c);
      //boolean remove(Object o)从集合中移除指定的元素
        boolean result = c.remove("123");
        System.out.println(result);
        System.out.println(c);
        //boolean removeIf(Object o)根据条件进行移除
        c.removeIf((String S)->{
            return S.length() == 3 ;
                }
        );
        System.out.println(c);
        //void   clear()清空集合中的元素
        c.clear();
        System.out.println(c);
        //boolean contains(Object o)判断集合中是否存在指定的元素
        boolean zxc = c.contains("123");
        System.out.println(zxc);
        //boolean isEmpty()判断集合是否为空
        boolean empty = c.isEmpty();
        System.out.println(empty);
    }
}
